package com.hsxc.cdz.base.util;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * 
 * @author 刘力文
 * spring 负责加载的类，加载时注入spring容器的上下文
 * 暴露给Netty dao层和service层的实例
 *
 */
public class ApplicationUtil implements ApplicationContextAware{
     private static ApplicationContext applicationContext;
     
     @Override
     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
         ApplicationUtil.applicationContext = applicationContext;
     }
     
     public static Object getBean(String name){
         return applicationContext.getBean(name);
     }
 }